<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class REXML::Attribute - rexml: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="Node.html">REXML::Node</a>
    <li><a class="include" href="Namespace.html">REXML::Namespace</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-3D-3D">#==</a>
    <li ><a href="#method-i-clone">#clone</a>
    <li ><a href="#method-i-doctype">#doctype</a>
    <li ><a href="#method-i-element-3D">#element=</a>
    <li ><a href="#method-i-hash">#hash</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-namespace">#namespace</a>
    <li ><a href="#method-i-node_type">#node_type</a>
    <li ><a href="#method-i-normalized-3D">#normalized=</a>
    <li class="calls-super" ><a href="#method-i-prefix">#prefix</a>
    <li ><a href="#method-i-remove">#remove</a>
    <li ><a href="#method-i-to_s">#to_s</a>
    <li ><a href="#method-i-to_string">#to_string</a>
    <li ><a href="#method-i-value">#value</a>
    <li ><a href="#method-i-write">#write</a>
    <li ><a href="#method-i-xpath">#xpath</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-REXML::Attribute">
    <h1 id="class-REXML::Attribute" class="class">
      class REXML::Attribute
    </h1>

    <section class="description">
    
<p>Defines an <a href="Element.html"><code>Element</code></a> <a href="Attribute.html"><code>Attribute</code></a>; IE, a attribute=value pair, as in: &lt;element attribute=“value”/&gt;.  <a href="Attributes.html"><code>Attributes</code></a> can be in their own namespaces.  General users of <a href="../REXML.html"><code>REXML</code></a> will not interact with the <a href="Attribute.html"><code>Attribute</code></a> class much.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="NEEDS_A_SECOND_CHECK">NEEDS_A_SECOND_CHECK
          <dd>
          <dt id="PATTERN">PATTERN
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-element" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">element</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The element to which this attribute belongs</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">( first, second=nil, parent=nil )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Constructor. FIXME: The parser doesn’t catch illegal characters in attributes</p>
<dl class="rdoc-list note-list"><dt>first
<dd>
<p>Either: an <a href="Attribute.html"><code>Attribute</code></a>, which this new attribute will become a clone of; or a String, which is the name of this attribute</p>
</dd><dt>second
<dd>
<p>If <code>first</code> is an <a href="Attribute.html"><code>Attribute</code></a>, then this may be an <a href="Element.html"><code>Element</code></a>, or nil. If nil, then the <a href="Element.html"><code>Element</code></a> parent of this attribute is the parent of the <code>first</code> <a href="Attribute.html"><code>Attribute</code></a>.  If the first argument is a String, then this must also be a String, and is the content of the attribute. If this is the content, it must be fully normalized (contain no illegal characters).</p>
</dd><dt>parent
<dd>
<p>Ignored unless <code>first</code> is a String; otherwise, may be the <a href="Element.html"><code>Element</code></a> parent of this attribute, or nil.</p>
</dd></dl>

<pre class="ruby"><span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">attribute_to_clone</span> )
<span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">attribute_to_clone</span>, <span class="ruby-identifier">parent_element</span> )
<span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">&quot;attr&quot;</span>, <span class="ruby-string">&quot;attr_value&quot;</span> )
<span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">&quot;attr&quot;</span>, <span class="ruby-string">&quot;attr_value&quot;</span>, <span class="ruby-identifier">parent_element</span> )
</pre>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 42</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>( <span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">parent</span>=<span class="ruby-keyword">nil</span> )
  <span class="ruby-ivar">@normalized</span> = <span class="ruby-ivar">@unnormalized</span> = <span class="ruby-ivar">@element</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Attribute</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">first</span>.<span class="ruby-identifier">expanded_name</span>
    <span class="ruby-ivar">@unnormalized</span> = <span class="ruby-identifier">first</span>.<span class="ruby-identifier">value</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">second</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Element</span>
      <span class="ruby-ivar">@element</span> = <span class="ruby-identifier">second</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-ivar">@element</span> = <span class="ruby-identifier">first</span>.<span class="ruby-identifier">element</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">String</span>
    <span class="ruby-ivar">@element</span> = <span class="ruby-identifier">parent</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">first</span>
    <span class="ruby-ivar">@normalized</span> = <span class="ruby-identifier">second</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;illegal argument #{first.class.name} to Attribute constructor&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-3D-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">==</span><span
                                class="method-args">( other )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns true if other is an <a href="Attribute.html"><code>Attribute</code></a> and has the same name and value, false otherwise.</p>

                              <div class="method-source-code" id="3D-3D-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">==</span>( <span class="ruby-identifier">other</span> )
  <span class="ruby-identifier">other</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Attribute</span>) <span class="ruby-keyword">and</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">name</span><span class="ruby-operator">==</span><span class="ruby-identifier">name</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">value</span><span class="ruby-operator">==</span><span class="ruby-identifier">value</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-clone" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">clone</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a copy of this attribute</p>

                              <div class="method-source-code" id="clone-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 163</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">clone</span>
  <span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-doctype" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">doctype</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="doctype-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 132</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">doctype</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@element</span>
    <span class="ruby-identifier">doc</span> = <span class="ruby-ivar">@element</span>.<span class="ruby-identifier">document</span>
    <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">doctype</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">doc</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-element-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">element=</span><span
                                class="method-args">( element )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Sets the element of which this object is an attribute.  Normally, this is not directly called.</p>

<p>Returns this attribute</p>

                              <div class="method-source-code" id="element-3D-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 171</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">element=</span>( <span class="ruby-identifier">element</span> )
  <span class="ruby-ivar">@element</span> = <span class="ruby-identifier">element</span>

  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@normalized</span>
    <span class="ruby-constant">Text</span>.<span class="ruby-identifier">check</span>( <span class="ruby-ivar">@normalized</span>, <span class="ruby-constant">NEEDS_A_SECOND_CHECK</span>, <span class="ruby-identifier">doctype</span> )
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-hash" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">hash</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates (and returns) a hash from both the name and value</p>

                              <div class="method-source-code" id="hash-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 111</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">hash</span>
  <span class="ruby-identifier">name</span>.<span class="ruby-identifier">hash</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">hash</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">inspect</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="inspect-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 197</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">inspect</span>
  <span class="ruby-identifier">rv</span> = <span class="ruby-string">+&quot;&quot;</span>
  <span class="ruby-identifier">write</span>( <span class="ruby-identifier">rv</span> )
  <span class="ruby-identifier">rv</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-namespace" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">namespace</span><span
                                class="method-args">(arg=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the namespace URL, if defined, or nil otherwise</p>

<pre class="ruby"><span class="ruby-identifier">e</span> = <span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;el&quot;</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_namespace</span>(<span class="ruby-string">&quot;ns&quot;</span>, <span class="ruby-string">&quot;http://url&quot;</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_attribute</span>(<span class="ruby-string">&quot;ns:a&quot;</span>, <span class="ruby-string">&quot;b&quot;</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_attribute</span>(<span class="ruby-string">&quot;nsx:a&quot;</span>, <span class="ruby-string">&quot;c&quot;</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">&quot;ns:a&quot;</span>).<span class="ruby-identifier">namespace</span> <span class="ruby-comment"># =&gt; &quot;http://url&quot;</span>
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">&quot;nsx:a&quot;</span>).<span class="ruby-identifier">namespace</span> <span class="ruby-comment"># =&gt; nil</span>
</pre>

<p>This method always returns “” for no namespace attribute. Because the default namespace doesn’t apply to attribute names.</p>

<p>From <a href="https://www.w3.org/TR/xml-names/#uniqAttrs">www.w3.org/TR/xml-names/#uniqAttrs</a></p>

<p>&gt; the default namespace does not apply to attribute names</p>

<pre class="ruby"><span class="ruby-identifier">e</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;el&quot;</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_namespace</span>(<span class="ruby-string">&quot;&quot;</span>, <span class="ruby-string">&quot;http://example.com/&quot;</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">namespace</span> <span class="ruby-comment"># =&gt; &quot;http://example.com/&quot;</span>
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_attribute</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;b&quot;</span>)
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">&quot;a&quot;</span>).<span class="ruby-identifier">namespace</span> <span class="ruby-comment"># =&gt; &quot;&quot;</span>
</pre>

                              <div class="method-source-code" id="namespace-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 95</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">namespace</span> <span class="ruby-identifier">arg</span>=<span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">arg</span> = <span class="ruby-identifier">prefix</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@element</span>.<span class="ruby-identifier">namespace</span>(<span class="ruby-identifier">arg</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-node_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">node_type</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="node_type-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 193</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">node_type</span>
  <span class="ruby-value">:attribute</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-normalized-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">normalized=</span><span
                                class="method-args">(new_normalized)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The normalized value of this attribute.  That is, the attribute with entities intact.</p>

                              <div class="method-source-code" id="normalized-3D-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 157</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalized=</span>(<span class="ruby-identifier">new_normalized</span>)
  <span class="ruby-ivar">@normalized</span> = <span class="ruby-identifier">new_normalized</span>
  <span class="ruby-ivar">@unnormalized</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-prefix" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">prefix</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the namespace of the attribute.</p>

<pre class="ruby"><span class="ruby-identifier">e</span> = <span class="ruby-constant">Element</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">&quot;elns:myelement&quot;</span> )
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_attribute</span>( <span class="ruby-string">&quot;nsa:a&quot;</span>, <span class="ruby-string">&quot;aval&quot;</span> )
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">add_attribute</span>( <span class="ruby-string">&quot;b&quot;</span>, <span class="ruby-string">&quot;bval&quot;</span> )
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">get_attribute</span>( <span class="ruby-string">&quot;a&quot;</span> ).<span class="ruby-identifier">prefix</span>   <span class="ruby-comment"># -&gt; &quot;nsa&quot;</span>
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">get_attribute</span>( <span class="ruby-string">&quot;b&quot;</span> ).<span class="ruby-identifier">prefix</span>   <span class="ruby-comment"># -&gt; &quot;&quot;</span>
<span class="ruby-identifier">a</span> = <span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">&quot;x&quot;</span>, <span class="ruby-string">&quot;y&quot;</span> )
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">prefix</span>                                   <span class="ruby-comment"># -&gt; &quot;&quot;</span>
</pre>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  
                              </div>

                              <div class="method-source-code" id="prefix-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">prefix</span>
  <span class="ruby-keyword">super</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-remove" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">remove</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Removes this <a href="Attribute.html"><code>Attribute</code></a> from the tree, and returns true if successful</p>

<p>This method is usually not called directly.</p>

                              <div class="method-source-code" id="remove-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 184</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">remove</span>
  <span class="ruby-ivar">@element</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">delete</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@element</span>.<span class="ruby-identifier">nil?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_s</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the attribute value, with entities replaced</p>

                              <div class="method-source-code" id="to_s-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 140</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@normalized</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@normalized</span>

  <span class="ruby-ivar">@normalized</span> = <span class="ruby-constant">Text</span><span class="ruby-operator">::</span><span class="ruby-identifier">normalize</span>( <span class="ruby-ivar">@unnormalized</span>, <span class="ruby-identifier">doctype</span> )
  <span class="ruby-ivar">@normalized</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_string" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_string</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns this attribute out as XML source, expanding the name</p>

<pre class="ruby"><span class="ruby-identifier">a</span> = <span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">&quot;x&quot;</span>, <span class="ruby-string">&quot;y&quot;</span> )
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">to_string</span>     <span class="ruby-comment"># -&gt; &quot;x=&#39;y&#39;&quot;</span>
<span class="ruby-identifier">b</span> = <span class="ruby-constant">Attribute</span>.<span class="ruby-identifier">new</span>( <span class="ruby-string">&quot;ns:x&quot;</span>, <span class="ruby-string">&quot;y&quot;</span> )
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">to_string</span>     <span class="ruby-comment"># -&gt; &quot;ns:x=&#39;y&#39;&quot;</span>
</pre>

                              <div class="method-source-code" id="to_string-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_string</span>
  <span class="ruby-identifier">value</span> = <span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@element</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@element</span>.<span class="ruby-identifier">context</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@element</span>.<span class="ruby-identifier">context</span>[<span class="ruby-value">:attribute_quote</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:quote</span>
    <span class="ruby-identifier">value</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;&quot;&#39;</span>, <span class="ruby-string">&#39;&amp;quot;&#39;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&#39;&quot;&#39;</span>)
    <span class="ruby-node">%Q^#@expanded_name=&quot;#{value}&quot;^</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">value</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot;&#39;&quot;</span>, <span class="ruby-string">&#39;&amp;apos;&#39;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;&#39;&quot;</span>)
    <span class="ruby-node">&quot;#@expanded_name=&#39;#{value}&#39;&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-value" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">value</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the UNNORMALIZED value of this attribute.  That is, entities have been expanded to their values</p>

                              <div class="method-source-code" id="value-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 149</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">value</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@unnormalized</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@unnormalized</span>
  <span class="ruby-ivar">@unnormalized</span> = <span class="ruby-constant">Text</span><span class="ruby-operator">::</span><span class="ruby-identifier">unnormalize</span>( <span class="ruby-ivar">@normalized</span>, <span class="ruby-identifier">doctype</span> )
  <span class="ruby-ivar">@unnormalized</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-write" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">write</span><span
                                class="method-args">( output, indent=-1 )</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Writes this attribute (EG, puts ‘key=“value”’ to the output)</p>

                              <div class="method-source-code" id="write-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 189</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">write</span>( <span class="ruby-identifier">output</span>, <span class="ruby-identifier">indent</span>=<span class="ruby-value">-1</span> )
  <span class="ruby-identifier">output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">to_string</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-xpath" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">xpath</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="xpath-source">
            <pre><span class="ruby-comment"># File rexml-3.2.6/lib/rexml/attribute.rb, line 203</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">xpath</span>
  <span class="ruby-identifier">path</span> = <span class="ruby-ivar">@element</span>.<span class="ruby-identifier">xpath</span>
  <span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;/@#{self.expanded_name}&quot;</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

